

import request from '@/utils/request'

// 添加专业 —— 指定写法
export function addMajor(data) {
  return request({
    url: '/major/add',
    method: 'post',
    data: data
  })
}

/* ===== 其余接口保持同样风格，顺手一起给出 ===== */
export function updateMajor(data) {
  return request({
    url: '/major/update',
    method: 'put',
    data: data
  })
}

export function deleteMajor(id) {
  return request({
    url: `/major/delete/${id}`,
    method: 'delete'
  })
}

export function batchDeleteMajor(ids) {
  return request({
    url: '/major/batchDelete',
    method: 'post',
    data: ids
  })
}

export function getPage(params) {
  return request({
    url: '/major',
    method: 'get',
    params: params
  })
}

export function getById(id) {
  return request({
    url: `/major/queryById/${id}`,
    method: 'get'
  })
}

export function getByName(majorName) {
  return request({
    url: '/major/queryByName',
    method: 'get',
    params: { majorName }
  })
}

export function getByCode(majorCode) {
  return request({
    url: '/major/queryByCode',
    method: 'get',
    params: { majorCode }
  })
}

// export function exportExcel() {
//   // 直接跳后端导出接口
//   window.open('/major/export')
// }